package com.example.mapdata.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mapdata.entity.User;
import org.apache.ibatis.annotations.*;


/**
 * (User)表数据库访问层
 *
 * @author makejava
 * @since 2024-09-23 14:22:52
 */
@Mapper
public interface UserDao extends BaseMapper<User> {

    /**
     * 根据登录用户名称获取用户信息
     */
    @Select("select * from user where username = #{username}")
    User getUserInfoByUsername(@Param("username") String username);

    /**
     * 修改指定用户的信息
     */
    int updateUser(@Param("name") String username,@Param("value") User user);

    /**
     * 删除指定用户
     */
    @Delete("delete from user where username = #{username}")
    int deleteUser(@Param("username") String username);

    /**
     * 根据用户名修改用户登录密码
     */
    @Update("update user set password = #{password} where username = #{username}")
    int updatePassword(@Param("username") String username,@Param("password") String password);
}

